package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.SchedulingSonSon;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SchedulingSonSonDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增id")
    private Integer id;

    @ApiModelProperty(value = "排产表id")
    private Integer schedulingId;

    @ApiModelProperty(value = "排产子表id")
    private Integer schedulingSonId;

    @ApiModelProperty(value = "生产单id")
    private Integer produceId;

    @ApiModelProperty(value = "产品id")
    private Integer productId;

    @ApiModelProperty(value = "拆解键名称")
    private String name;

    @ApiModelProperty(value = "设备id")
    private Integer equipmentId;

    @ApiModelProperty(value = "排产数量")
    private Integer schedulingNum;

    @ApiModelProperty(value = "生产状态：1生产中2生产完成")
    private Integer type;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "完成时间")
    private Double finishHour;


    public SchedulingSonSonDTO() {}

    public SchedulingSonSonDTO(SchedulingSonSon entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static SchedulingSonSonDTO convert(SchedulingSonSon entity) {
        return new SchedulingSonSonDTO(entity);
    }

    public static List<SchedulingSonSonDTO> convertList(List<SchedulingSonSon> list) {
        List<SchedulingSonSonDTO> resultList = new ArrayList<>();
        for (SchedulingSonSon entity : list) {
            resultList.add(new SchedulingSonSonDTO(entity));
        }
        return resultList;
    }}
